//
//  ShoppingCarCell.m
//  SDHuiYuShoping
//
//  Created by luojiao on 2017/5/4.
//  Copyright © 2017年 luojiao. All rights reserved.
//

#import "ShoppingCarCell.h"

@implementation ShoppingCarCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [_choseButton setImage:[UIImage imageNamed:@"select_btn"] forState:UIControlStateNormal];
    [_choseButton setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -16)];
    [_choseButton addTarget:self action:@selector(checkButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    _productBgImage.image = [UIImage imageNamed:@"picture_bg"];
    _subAndAddBg.image = [UIImage imageNamed:@"number_bg"];
    
    _textField.text = @"1";
    
    [_subButton setImage:[UIImage imageNamed:@"sub_btn_dis"] forState:UIControlStateNormal];
    [_subButton setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -13)];

    [_addButton setImage:[UIImage imageNamed:@"add_btn"] forState:UIControlStateNormal];
    [_addButton setImageEdgeInsets:UIEdgeInsetsMake(0, -13, 0, 0)];

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)checkButtonClick:(UIButton *)button
{

    if (_delegate && [_delegate respondsToSelector:@selector(chooseButton:)])
    {
        [_delegate chooseButton:self];
    }
}



- (IBAction)addButton:(id)sender
{
    if (_delegate && [_delegate respondsToSelector:@selector(addButtonClick:)])
    {
        [_delegate addButtonClick:self];
    }

}
- (IBAction)subButton:(id)sender
{
    if (_delegate && [_delegate respondsToSelector:@selector(subButtonClick:)])
    {
        [_delegate subButtonClick:self];
    }
}



@end
